package com.demo.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.demo.config.LoggerManage;
import com.demo.entity.Employee;
import com.demo.service.EmployeeService;

/** 
* @项目名称：springboot-jpa-demo 
* @类名称：IndexController 
* @类描述： 
* @创建人：YangChao
* @联系方式：18629233301@163.com 
* @创建时间：2017年12月27日 上午11:09:56 
* @version 1.0.0
*/
@Controller
public class IndexController {
	@Autowired
	private EmployeeService employeeService;

	@ResponseBody
	@RequestMapping("/getlist")
	@LoggerManage(description = "员工列表")
	public Page<Employee> list(Employee employee) {
		Pageable pageable = new PageRequest(1, 10);
		return employeeService.findAll(pageable, employee);
	}

	@ResponseBody
	@RequestMapping("/list")
	@LoggerManage(description = "员工列表")
	public Page<Employee> list() {
		Pageable pageable = new PageRequest(0, 10);
		return employeeService.findAll(pageable, new Employee());
	}

}
